package subject_set.lanqiao;

import java.util.Scanner;

/**
 * @author haomin
 * @date 2022/10/25 17:08
 **/
public class Num5 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int ans = 0;
        for(int i = 1; i <= 2020; ++i){

            int tem = i;
            while(tem != 0) {
                if (tem % 10 == 2) ans++;
                tem /= 10;
            }
        }
        System.out.println(ans);
        scan.close();
    }
}